package com.example.administrator.zhongyichou.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.example.administrator.zhongyichou.base.BaseActivity;
import com.example.administrator.zhongyichou.Bean.BaseEventBean;
import com.example.administrator.zhongyichou.fragment.RefundFragment;
import com.example.administrator.zhongyichou.fragment.WithdrawalsFragment;
import com.example.administrator.zhongyichou.net.core.HttpLoader;
import com.example.administrator.zhongyichou.net.protocol.GsonBaseProtocol;
import com.example.administrator.zhongyichou.view.HeaderView;
import com.example.administrator.zhongyichou.view.PagerSlidingTabStrip;
import com.example.administrator.zhongyichou.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by lichenyu on 2017/11/24.
 * 描述：项目钱包
 */

public class WalletActivity extends BaseActivity {
    @BindView(R.id.headerview)
    HeaderView headerview;
    @BindView(R.id.tab)
    PagerSlidingTabStrip tab;
    @BindView(R.id.viewpager)
    ViewPager viewpager;
    private WithdrawalsFragment withdrawalsFragment;
    private RefundFragment refundFragment;
    private String[] titles = {"提现", "退款"};
    private String infoID;

    @Override
    protected void init() {
        ButterKnife.bind(this);
        infoID = getIntent().getStringExtra("info_id");
        viewpager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                Bundle bundle = new Bundle();
                bundle.putString("info_id", infoID);
                if (position == 0) {
                    if (withdrawalsFragment == null)
                        withdrawalsFragment = new WithdrawalsFragment();
                    withdrawalsFragment.setArguments(bundle);
                    return withdrawalsFragment;
                } else {
                    if (refundFragment == null)
                        refundFragment = new RefundFragment();
                    refundFragment.setArguments(bundle);
                    return refundFragment;
                }
            }

            @Override
            public int getCount() {
                return titles.length;
            }

            @Override
            public CharSequence getPageTitle(int position) {
                return titles[position];
            }
        });
        tab.setViewPager(viewpager);
    }

    @Override
    protected void responseData(GsonBaseProtocol mGsonBaseProtocal) {

    }

    @Override
    protected HttpLoader initHttpLoader() {
        return null;
    }

    @Override
    protected int initContentView() {
        return R.layout.wallet_activity;
    }

    @Override
    public boolean onEventBus(BaseEventBean baseEventBean) {

        return false;
    }
}
